package com.qwt.part_time_api.error;

/**
 * @Author 君子慎独
 * @create 2021/11/22 0022 13:32
 * 统一的错误码
 * <p>
 * 错误码列表
 */
public enum ErrorCode {
    /**
     * 通用错误类型 00001
     */
    PARAMETER_VALIDATION_ERROR(00001, "参数不合法"),

    /**
     * 20000 开头为用户信息的错误定义
     */
    USER_NOT_EXIST(20001, "用户不存在"),
    USER_REPEAT_LOGIN(20003, "该用户已经登录"),
    USER_NO_LOGIN(20002, "未登录"),
    USER_ACCOUNT_EXPIRED(20008, "账号已过期"),
    USER_ACCOUNT_DISABLE(20004, "账号不可用"),
    USER_ACCOUNT_LOCKED(20005, "账号被锁定"),
    USER_LOGIN_FAILED(20007, "登陆失败"),
    USER_CREDENTIALS_EXPIRED(20010, "密码过期"),
    USER_CREDENTIALS_ERROR(20009, "密码错误"),
    USER_ACCOUNT_ALREADY_EXIST(20006, "账号已存在"),
    USER_ACCOUNT_NOT_NULL(20011, "账号不为空"),
    USER_LOGOUT_SUCCESS(20012, "退出成功"),
    USER_LOGOUT_FAIL(20013, "该用户未登录或已经退出"),
    /**
     * 10000 参数验证
     */
    ERR_SMS_VERIFICATIO(10001, "短信验证码错误"),
    ERR_USER_PARAMS(10002, "账号或密码错误"),
    ERR_IMAGE_UPLOAD(10003, "图片上传失败"),
    ERR_NO_PERMISSION(10004, "无权限访问"),
    ERR_NO_NULL(10005, "参数不为空"),
    ERR_NO_SUCH_CITY(10006, "无该城市"),
    ERR_CODE_OUT(10007, "请在规定时间内输入验证码"),
    ERR_CODE_LENGTH(10008, "验证码长度不符合规范"),
    ERR_CODE_NULL(10008, "验证码不为空"),
    ERR_CODE_WRONG(10008, "请输入正确的验证码"),

    /**
     * 会话
     */
    TOKEN_TIME_OUT(40001, "Token 过期"),
    TOKEN_TOKEN_ERROR(40002, "Token不合法"),
    TOKEN_UNAUTHORIZEDT(40007, "无token凭证"),
    /**
     * 加解密
     */
    ERR_ENCRYPTION(90001, "加密失败"),
    ERR_DECRYPTION(90002, "解密失败"),
    ;

    private int errCode;
    private String errMsg;

    ErrorCode(int errCode, String errMsg) {
        this.errMsg = errMsg;
        this.errCode = errCode;
    }

    public int getErrCode() {
        return errCode;
    }

    public void setErrCode(int errCode) {
        this.errCode = errCode;
    }

    public String getErrMsg() {
        return errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }
}